package com.example.md.mddemo.exception;

import lombok.Data;

/**
 * Copyright © 2018年 ziniuxiaozhu. All rights reserved.
 *
 * @Author 临江仙 hzqiuxm@163.com
 * 统一的业务级异常父类
 * @Date 2018/9/14 13:05
 */
@Data
public abstract class BusinessException extends RuntimeException{

    //异常处理编码
    private final int code;
    //异常处理信息
    private final String msg;
    //异常时间，转换成String避免精度缺失
    private final String timestamp = String.valueOf(System.currentTimeMillis());

    protected BusinessException(int code, String msg){
        this.code = code;
        this.msg = msg;
    }

    protected BusinessException(int code, String msg, Exception e) {
        super(e);
        this.code = code;
        this.msg = msg;
    }

}
